<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Escapes a string for use as a query parameter</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.sqlite-escape-string" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">sqlite_escape_string</h1>
  <p class="verinfo">(PHP 5 &lt; 5.4.0, PECL sqlite &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">sqlite_escape_string</span> &mdash; <span class="dc-title">Escapes a string for use as a query parameter</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.sqlite-escape-string-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>sqlite_escape_string</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$item</code></span>
   ) : <span class="type">string</span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>sqlite_escape_string()</strong></span> will correctly quote the string
   specified by <code class="parameter">item</code>
   for use in an SQLite SQL statement.  This includes doubling up
   single-quote characters (<em>&#039;</em>) and checking for
   binary-unsafe characters in the query string.
  </p>
  <p class="para">
   Although the encoding makes it safe to insert the data, it will render
   simple text comparisons and <em>LIKE</em> clauses in your
   queries unusable for the columns that contain the binary data.  In
   practice, this shouldn&#039;t be a problem, as your schema should be such that
   you don&#039;t use such things on binary columns (in fact, it might be better to
   store binary data using other means, such as in files).
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.sqlite-escape-string-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">item</code></dt>

     <dd>

      <p class="para">
       The <span class="type"><a href="language.types.string.html" class="type string">string</a></span> being quoted.
      </p>
      <p class="para">
       If the <code class="parameter">item</code> contains a <em>NUL</em>
       character, or if it begins with a character whose ordinal value is
       <em>0x01</em>, PHP will apply a binary encoding scheme so that
       you can safely store and retrieve binary data.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>

 
 <div class="refsect1 returnvalues" id="refsect1-function.sqlite-escape-string-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns an escaped <span class="type"><a href="language.types.string.html" class="type string">string</a></span> for use in an SQLite SQL statement.
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.sqlite-escape-string-notes">
  <h3 class="title">注释</h3>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <span class="simpara">
    Do not use this function to encode the return values from UDF&#039;s created
    using <span class="function"><a href="sqlite_create_function.html" class="function">sqlite_create_function()</a></span> or
    <span class="function"><a href="sqlite_create_aggregate.html" class="function">sqlite_create_aggregate()</a></span> - use
    <span class="function"><a href="sqlite_udf_encode_binary.html" class="function">sqlite_udf_encode_binary()</a></span> instead.
   </span>
  </p></blockquote>
  <div class="warning"><strong class="warning">Warning</strong>
   <p class="simpara">
    <span class="function"><a href="addslashes.html" class="function">addslashes()</a></span> should <em class="emphasis">NOT</em> be used to
    quote your strings for SQLite queries; it will lead to strange results
    when retrieving your data.
   </p>
  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.sqlite-escape-string-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="sqlite_udf_encode_binary.html" class="function" rel="rdfs-seeAlso">sqlite_udf_encode_binary()</a> - Encode binary data before returning it from an UDF</span></li>
   </ul>
  </p>
 </div>

</div></div></div></body></html>